home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Utilities Experience
/
The Utilities Experience - Volume 1.iso
/
software
/
demos
/
r-z
/
sbase4pro
/
invoice
/
invoice.sbp
< prev
next >
Wrap
Text File
|
1995-07-10
|
7KB
|
310 lines
SBP
ÿ½ *** Browning 3/14/91
ÿ½ *** Invoice driven by DML Procedural program
ÿ½ *** Learning example
ÿ½ *** Requires V1.21 or greater
ÿ½ *** Not presented as a finished application
ÿ³ÿ_ÿwErrTrap
ÿ¬ÿ
ÿÊÿË""
ÿ½ *** Initialize the panel, W$, and pan% for execute statement
ÿ½ *** used in WaitMenu: below. W$ and pan% are modified by the
ÿ½ *** routine in Column3:
ÿâÿe:w$ÿ"wait panel off or menu":pan%ÿ1
ÿ´ÿ"product"
ÿ´ÿ"invoice"
ÿ½ *** Set up menu structure
ÿ¬1,0,1,"&File "
ÿ¬1,1,1,"&Print"
ÿ¬1,2,1,"&Setup printer"
ÿ¬1,3,3
ÿ¬1,4,1,"E&xit"
ÿ¬2,0,1,"&Record "
ÿ¬2,1,1,"&New"
ÿ¬2,2,3
ÿ¬2,3,1,"&Delete "
ÿ¬3,0,1,"&Utility "
ÿ¬3,1,1,"&VCR Panel"
ÿ¬3,2,3
ÿ¬3,3,1,"&Shell"
WaitMenu:
ÿÊÿË"Choose item from menu"
ÿ¬ÿ³column%,item%
ÿw$
ÿ³column%ÿvColumn1,Column2,Column3
ÿwWaitMenu
Column1: ÿ½ *** File Menu
ÿÉÿæitem%
ÿæ1
ÿ¹ÿYÿíÿs0,0,0,0,0,0,0
ÿæ2
ÿÊÿhÿÂ
ÿæ4
ÿ:ÿ
ÿÿÉ
ÿÃ
Column2: ÿ½ *** Record Menu
ÿÉÿæitem%
ÿæ1
ÿvEnterIt
ÿæ3
ÿvDeleteIt
ÿÿÉ
ÿÃ
Column3: ÿ½ *** Utility Menu
ÿÉÿæitem%
ÿæ1:ÿ½ *** w$ is used in WaitMenu:
ÿ¡Pan%ÿ1ÿp
w$ÿ"wait panel or menu"
Pan%ÿ0
ÿ^
w$ÿ"panel off:wait panel off or menu"
Pan%ÿ1
ÿÿ¡
ÿæ3
ÿ"newshell"
ÿßÿ³
ÿÿÉ
ÿÃ
EnterIt: ÿ½ *** Complete entry and validation of form data
ÿÿ
CustDataEntry: ÿ½ *** Handle customer entry and validation
ÿÊÿË"Enter full or partial customer code or N to create new customer"
ÿC_LINK.customer,1
ÿ½ *** Make user enter something
ÿØc_link.customerÿ""
ÿÊÿË"*** Blank entry NOT accepted ***"
ÿx%%ÿ1ÿq10:ÿ:ÿ±x%%
ÿÏÿ.7
ÿÊÿË"Enter full or partial customer code or N to create new customer"
ÿc_link.customer
ÿÙ
ÿÊÿË""
ÿ¡ÿ>(C_LINK.customer)ÿ"N"ÿpÿvAddNewCustomer
ÿ½ *** Find the record if it exists
ÿ¡ÿJ(C_LINK.customer,C_LINK.customer)ÿp
ÿÉÿ¥C_LINK.customerÿ"customer":ÿ½ *** Make the true record current
ÿ:ÿ½ *** Make it show on the form
ÿ^
ÿÂ"Choose Customer OR","Enter N for NEW",20,,C_LINK.customer,30,C_LINK.customer,COMPANY.customer
ÿ¡ÿ>(C_LINK.customer)ÿ"N"ÿpÿvAddNewCustomer
ÿÉÿ¥C_LINK.customerÿ"customer"
ÿ
ÿÿ¡
ÿÊÿË""
C_LINK.invhdrÿC_LINK.customer
D_LINK.invhdrÿÿI("invhdr")
HeaderEntry: ÿ½ Handle invoice header information
ÿÊÿË"Enter SHIP TO address"
ÿscompany.invhdrÿqszip.invhdr:ÿ½ *** Enter Ship-to address
INVDATE.invhdrÿÿQ: ÿ½ *** Set date automatically
ÿÊÿË"Accept or modify terms"
INVTERMS.invhdrÿTERMS.customer: ÿ½ *** Move data in customer file to invhdr
ÿinvterms.invhdr:ÿ½ *** Give the user the chance to modify
BodyEntry:
rct%%ÿ1:ÿ½ *** Set row counter
ÿ½ *** ORDER returns a negative when Escape key pressed
ÿØÿµÿÿ1
ÿÊÿË"Enter quantity"
ÿquantity.ldetailÿ"rct%%
ÿ¡quantity.ldetailÿ0ÿpÿÿØ
ÿÊÿË"Enter full or partial stock code"
ÿstkcode.ldetailÿ"rct%%
ÿ½ *** Do not accept a blank entry
ÿØstkcode.ldetailÿ""
ÿÊÿË"Blank entry NOT accepted"
ÿx%%ÿ1ÿq10:ÿ:ÿ±x%%
ÿÏÿ.7
ÿÊÿË"Enter full or partial stock code or N for new product"
ÿstkcode.ldetailÿ"rct%%
ÿÙ
ÿ¡ÿ>(stkcode.ldetail)ÿ"N"ÿpÿvAddNewProduct
LkUp: ÿ½ *** Verify stockcode exists and give option for new code.
ÿ¡ÿD(stkcode.ldetail,stkcode.product)ÿp
ÿ^
ÿÂ"Choose code OR","Enter 'N' to add new code.",20,a%,stkcode.ldetail,50,stkcode.product,description.product
ÿ¡ÿ>(stkcode.ldetail)ÿ"N"ÿpÿvAddNewProduct
ÿwLkUp
ÿÿ¡
ÿ½ *** Get data from product file and move it to ldetail file
description.ldetailÿdescription.product
unitcost.ldetailÿunitcost.product
extcost.ldetailÿ(quantity.ldetailÿunitcost.ldetail)
ÿ½ *** Move data from file ldetail to current form transaction line and show it
ÿÍÿÿ"rct%%:ÿ
ÿ½ *** Move the cursor back to start of line so data can be modified
ÿ½ *** Perhaps bad accounting practice but client wishes it
ÿÊÿË"Accept or modify description line"
ÿdescription.ldetailÿ"rct%%
ÿÊÿË"Accept or modify unit price"
ÿunitcost.ldetailÿ"rct%%
ÿÊÿË""
extcost.ldetailÿ(quantity.ldetailÿunitcost.ldetail)
invtotal.invhdrÿÿl(extcost.ldetail)
ÿÍÿÿ"rct%%:ÿ
rct%%ÿrct%%ÿ1
ÿÙ
ÿÂ"Save this invoice?","",130,a%
ÿ¡a%ÿp
ÿÌÿ
ÿ^
ÿÉÿÿY
ÿ
ÿÿ¡
ÿÃ
AddNewCustomer: ÿ½ *** 'N' was entered
ÿÂ"Are you sure you want","to create a new customer?",130,a%
ÿ¡a%ÿp
ÿÊÿË"Enter customer information"
ÿÿ"customer"
ÿcompany.customerÿqzip.customer
x%%ÿ1
ky$ÿÿ+(company.customer,3)ÿÿ(x%%,"000.")
ÿØÿJ(ky$,c_link.customer)
x%%ÿx%%ÿ1
ky$ÿÿ+(company,3)ÿÿ(x%%,"000.")
ÿÙ
c_link.customerÿky$
ÿÂ"Add this customer","to customer file?",130,a%
ÿ¡a%ÿp
ÿÌÿ"customer"
ÿ^
ÿÉÿÿY
ÿ
ÿwWaitMenu
ÿÿ¡
ÿ
ÿÃ
ÿ^
ÿÃ
ÿÿ¡
ÿÃ
AddNewProduct: ÿ½ *** 'N' was entered in Lookup (Lkup)
desc$ÿ"":unit%ÿ0:stkcode$ÿ""
ÿÂ"Are you sure you want","to create a new product entry?",130,a%
ÿ¡a%ÿp
ÿ2
ÿÊÿË"Enter product description EXAMPLE: Widget Brown"
79 :ÿ79:ÿ½ *** desc$
ÿ¡ÿ/(desc$)ÿ
3ÿpÿw79
ÿÊÿË"Enter product unitcost EXAMPLE: 14.98"
80 :ÿ80:ÿ½ *** unit%
ÿ¡unit%ÿ 0ÿpÿw80
ÿÊÿË"Generating unique ID"
ÿ½ *** Build unique stock code
x%%ÿ1
stkcode$ÿÿ+(desc$,3)ÿÿ(x%%,"000.")
ÿØÿJ(stkcode$,stkcode.product)
x%%ÿx%%ÿ1
stkcode$ÿÿ+(desc$,3)ÿÿ(x%%,"000.")
ÿÙ
ÿ
ÿÂ"Add this product","to product file?",130,a%
ÿ¡a%ÿp
ÿÿ"product"
stkcode.productÿstkcode$
description.productÿdesc$
unitcost.productÿunit%
ÿÌÿ"product"
ÿÉÿÿ"rct%%
stkcode.ldetailÿstkcode.product
ÿ^
ÿ1
ÿÃ
ÿÿ¡
ÿ1
ÿÃ
ÿ^
ÿ1
ÿÃ
ÿÿ¡
ÿ1
ÿÃ
DeleteIt:
ÿdlt$
ÿ×dlt$(12)
dlt$(0)ÿ"1> Just this invoice"
dlt$(1)ÿ"2> Customer and all of its invoices"
rdlt$ÿ""
ÿÂ"Choose the appropriate deletion method","",20,a%,rdlt$,40,dlt$
ÿÉÿæÿ0(ÿ+(rdlt$,1))
ÿæ1
ÿÂ"Are you sure you wish","to delete this invoice?",148,a%
ÿ¡a%ÿp
ÿØÿD(d_link.invhdr,d_link.ldetail)
ÿÉÿ¾ÿ"ldetail"
ÿÙ
ÿÉÿ¾ÿ"invhdr"
ÿ^
ÿÃ
ÿÿ¡
ÿæ2
ÿÂ"You are about to delete this customer","and ALL invoices! Are you SURE?",148,a%
ÿ¡a%ÿp
ÿØÿD(c_link.customer,c_link.invhdr)
ÿØÿD(d_link.invhdr,d_link.ldetail)
ÿÉÿ¾ÿ"ldetail"
ÿÙ
ÿÉÿ¾ÿ"invhdr"
ÿÙ
ÿÉÿ¾ÿ"customer"
ÿ^
ÿÃ
ÿÿ¡
ÿæÿ^
ÿÃ
ÿÿÉ
ÿÉÿÿY
ÿ
ÿÃ
ErrTrap:
ÿÉÿæÿ&
ÿæ10
ÿ
ÿy
ÿæ8
ÿy
ÿæ11
ÿÂ"Break detected","End program execution?",130,a%
ÿ¡a%ÿp
ÿ
ÿ^
ÿy
ÿæÿ^
ÿx%%ÿ1ÿq10:ÿ:ÿ±x%%
ÿÊÿË"*** Error "ÿÿ((ÿ&)ÿ" "ÿÿ(ÿ&,"000."):ÿ
ÿÿÉ